//package study.springboot.server.support.tomcat;
//
//import lombok.extern.slf4j.Slf4j;
//import org.apache.catalina.connector.Connector;
//import org.apache.coyote.http11.Http11NioProtocol;
//import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
//import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
//import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
//import org.springframework.context.annotation.Bean;
//import org.springframework.stereotype.Component;
//
//@Slf4j
//@Component
//public class TomcatConfig111 implements {
//
////    private static final String PROTOCOL = "org.apache.coyote.http11.Http11NioProtocol";
////
////    @Bean
////    public ConfigurableServletWebServerFactory configurableServletWebServerFactory() {
////        //连接器
////        Connector connector = new Connector(PROTOCOL);
////        Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
////        connector.setPort(8090);
////        protocol.setMaxThreads(2);
////        protocol.setMaxConnections(10);
////        protocol.setAcceptCount(1000);
////        //server工厂
////        TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
////        //
////        tomcat.addAdditionalTomcatConnectors(connector);
////        //
////        TomcatConnectorCustomizer t;
////        return tomcat;
////    }
////
////    public class CustomTomcatConnectorCustomizer implements TomcatConnectorCustomizer {
////
////        @Override
////        public void customize(Connector connector) {
////            Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
////            //定制化keepAliveTimeout，设置30秒内没有请求则服务端自动断开keepalive链接
////            protocol.setKeepAliveTimeout(300000);
////            //当客户端发送超过10000个请求则自动断开keepalive链接
////            protocol.setMaxKeepAliveRequests(10000);
////
////            int maxThreads = protocol.getMaxThreads();
////            int minSpareThreads = protocol.getMinSpareThreads();
////            int maxConnections = protocol.getMaxConnections();
////            int acceptCount = protocol.getAcceptCount();
////            log.info(">>>>>> max_threads= {}, accept_count= {}", maxThreads, acceptCount);
////            log.info(">>>>>> min_spare_threads= {}", minSpareThreads);
////            log.info(">>>>>> max_connections= {}", maxConnections);
////        }
////    }
//}
